#lang racket

(define-struct address-book (name number))

(define (whos-number number addr-list)
  (cond
    [(empty? addr-list) empty]
    [else (cond
            [(= number (address-book-number (first addr-list))) 
             (address-book-name (first addr-list))]
            [else (whos-number number (rest addr-list))]
            )]
    )
  )

(define (phone-number name addr-list)
  (cond
    [(empty? addr-list) empty]
    [else (cond
            [(symbol=? name (address-book-name (first addr-list))) 
             (address-book-number (first addr-list))]
            [else (phone-number name (rest addr-list))]
            )]
    )
  )

; Test
(define addr
  (cons (make-address-book 'Andy '85048)
        (cons (make-address-book 'Okay '10086)
              (cons (make-address-book 'Wendy '110)
                    (cons (make-address-book 'Lucy '120) empty)))))

(whos-number '10086 addr)
(phone-number 'Andy addr)
